const getConnection = require('../utils/GetConnection');



let getAccessToken = () =>{
    getConnection('SELECT * FROM wechat_access_token',[],(err,result)=>{
        if(err){
            console.log(err);
            return;
        }
        console.log(result);
    });
};


function a(){
    let val = 5;
    if(val === 5){
        return new Promise((resolve,reject)=>resolve(val));
    }

    return new Promise(resolve=>resolve(val));
}


 async function test(){
    try {
        let val = await a();
        console.log(`查询结果是:${val}`);

    } catch (e) {
        switch (e.status){
            case 1:
                console.error('没有这个值');
                break;
            case 2:
                console.error('计算出错');
                break;
            default:
                console.error(e);
                break;
        }
    }
}
getAccessToken();
test();